package org.example.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private boolean succeed;
    private String message;
    private Object data;
    public static Result success(String message) {
        return new Result(true, message, null);
    }
    public static Result success(Object data) {
        return new Result(true, "操作成功", data);
    }
    public static Result success() {
        return new Result(true, "操作成功", null);
    }
    public static Result success(String message, Object data) {
        return new Result(true, message, data);
    }
    public static Result error(String message) {
        return new Result(false, message, null);
    }
    public static Result error() {
        return new Result(false, "未知错误，请联系管理员", null);
    }
}
